<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<?php $this->load->view('head'); ?>
	<script type="text/javascript">
		function sign(){
			var total = 0;			
			$('input.each-price').each(function () {
				if($(this).val()!="")			  
					total += parseFloat($(this).val());
				var tmp_id = '#p'+$(this).attr('id');					
				$(tmp_id).val($(this).val());
			});

			$('input.each-bus-type').each(function () {				
				var tmp_id_bus_type = '#t'+$(this).attr('id');
				$(tmp_id_bus_type).val($(this).val());
			});
			
			$('#price').val(total);
			$('#mprice').val(total);
		}
		jQuery(document).ready(function() {
			jQuery("form").each(function() {
				var cForm = jQuery(this);
				jQuery(cForm).submit(function(e) {
					var canSubmit = true;
					
					jQuery(cForm).find(":input").each(function() {
						if (jQuery(this).attr("type") != "checkbox" && jQuery(this).attr("type") != "radio" && jQuery(this).attr("type") != "submit" && jQuery(this).attr("name") != "acceptDenyMsg" && jQuery(this).attr("name") != "moreinfo") {
							 if (jQuery(this).val() == "" && jQuery(this).is(':visible')) {
								 canSubmit = false;
							 }
						}
					});
					
					if (canSubmit) return true;
					else {
						alert("All fields are required.");
						
						e.preventDefault();
						return false;
					}
				});
			});
			
			sign();
			
			$('input.each-price').change(function() {
				sign();
			});
			
			$('input.each-bus-type').change(function() {
				sign();
			});
		});
	</script>
</head>

<body>
<script type="text/javascript">
var site_url = "http://bookabus.sg/";
$(document).ready(function(){
	
  //hide toolbar and make visible the 'show' button
	$("span.downarr a").click(function() {
    $("#toolbar").slideToggle("fast");
    $("#toolbarbut").fadeIn("slow");    
  });
  
  //show toolbar and hide the 'show' button
  $("span.showbar a").click(function() {
    $("#toolbar").slideToggle("fast");
    $("#toolbarbut").fadeOut();    
  });
  
  //show tooltip when the mouse is moved over a list element 
  $("ul#social li").hover(function() {
		$(this).find("div").fadeIn("fast").show(); //add 'show()'' for IE
    $(this).mouseleave(function () { //hide tooltip when the mouse moves off of the element
        $(this).find("div").hide();
    });
  });
  
  //don't jump to #id link anchor 
  $(".facebook, .twitter, .delicious, .digg, .rss, .stumble, .menutit, span.downarr a, span.showbar a").click(function() {
   return false;                                         
	});
	
  //show quick menu on click 
	$("span.menu_title a").click(function() {
		if($(".quickmenu").is(':hidden')){ //if quick menu isn't visible 
			$(".quickmenu").fadeIn("fast"); //show menu on click
		}
		else if ($(".quickmenu").is(':visible')) { //if quick menu is visible 
      $(".quickmenu").fadeOut("fast"); //hide menu on click
    }
	});
	
	//hide menu on casual click on the page
	$(document).click(function() {
			$(".quickmenu").fadeOut("fast");
			$(".quickmenu").css({'vivibility': 'hidden'});
	});
	$('.quickmenu').click(function(event) { 
		event.stopPropagation(); //use .stopPropagation() method to avoid the closing of quick menu panel clicking on its elements 
	});

		
});
	function jobaction(radioObj) {
		window.location = site_url+"joborder/"+radioObj+"#actionForm";
	}
	function deletejob(radioObj) {
		window.location = site_url+"joborder/admdelete/"+radioObj;
	}
	function denyquotation(radioObj) {
				var a = confirm("Do you want to deny this quotation ?");
				if(a ){
					var reason = prompt("Reason :","");
					window.location = site_url+"joborder/deny/"+radioObj+"?reason="+reason;
					
				}
	}
	function reusejob(radioObj) {
				window.location = site_url+"joborder/reuse/"+radioObj;
	}
	function payment(radioObj) {

				var purpose = prompt("Purpose of this payment: ","");
				window.location = site_url+"joborder/payment/"+radioObj+"?purpose="+purpose;
	}
	function editjob(radioObj) {
		window.location = site_url+"request/time-based/0/"+radioObj;
	}
	function receivepayment(radioObj) {
		window.location = site_url+"joborder/receive_payment/"+radioObj;
	}
	


</script>
<div id="toolbarbut"> <!-- hide button -->
<span class="showbar"><a href="#">show bar</a></span>
</div>

<div id="toolbar"> <!-- toolbar container -->

<div class="leftside"> <!-- all things in floating left side -->
  <ul id="social"><center><strong>
    <li><a class="taskbar_tool" onclick="jobaction(<?php echo (substr($this->Jobs->getID($job),10,3)); ?>);"> Edit Price</a><!-- icon -->
    </li>
	<li><a class="taskbar_tool" onclick="jobaction(<?php echo (substr($this->Jobs->getID($job),10,3)); ?>);"> New Message</a><!-- icon -->
    </li>
	<li><a class="taskbar_tool" onclick="editjob(<?php echo (substr($this->Jobs->getID($job),10,3)); ?>);" > Edit Job</a><!-- icon -->
    </li>
	<li><a class="taskbar_tool" onclick="receivepayment(<?php echo (substr($this->Jobs->getID($job),10,3)); ?>);" > Receive Payment</a><!-- icon -->
    </li>
	<li><a class="taskbar_tool" onclick="denyquotation(<?php echo (substr($this->Jobs->getID($job),10,3)); ?>);"> Deny Quotation</a><!-- icon -->
    </li>
	<li><a class="taskbar_tool" onclick="deletejob(<?php echo (substr($this->Jobs->getID($job),10,3)); ?>);"> Delete Job</a><!-- icon -->
    </li>
	<li><a class="taskbar_tool" onclick="payment(<?php echo (substr($this->Jobs->getID($job),10,3)); ?>);"> Payment</a><!-- icon -->
    </li>
	<li><a class="taskbar_tool" onclick="reusejob(<?php echo (substr($this->Jobs->getID($job),10,3)); ?>);"> Reuse Job</a><!-- icon -->
    </li>
	</strong>
    </center>
  </ul>
</div>
<div class="rightside"> <!-- all things in floating left side -->
  <span class="downarr"> <!-- hide button -->
  <a href="#"></a>
  </span>
  
</div>

</div>
	<?php if ($user->level > 0): ?>
	<?php $this->load->view('header_admin.php'); ?>
	<?php else: ?>
	<?php $this->load->view('header_logged.php'); ?>
	<?php endif; ?>
	
	<!-- Content Area -->
	<div class="wrapper-world content">
		<div class="wrapper">
			<?php
				if ($job->cancel == 1) { // cancellation payment
					$userPricePaid = $job->cancelfee;
				} else { // normal payment
					$userPricePaid = $this->Jobs->neededPayment($job->gid);
				}
			?>
			<h1>Job ID <?php echo $this->Jobs->getID($job); ?><?php if ($user->level > 0 && $user->level != 2) { ?> <span class="quantity link"><?php echo anchor('/invoices/gen/'.$job->gid, '+ Issue Invoice'); ?></span> <?php if (($job->status == 2 && $job->cancel != 1) || ($job->status == 4 && $job->cancel != 1) || ($job->cancel == 1 && $job->cancelfee > 0 && $job->cancelfeepaid != 1)) { ?><span class="quantity link"><?php echo anchor('/joborder/userpaid/'.$job->gid, $this->Jobs->formatPrice($userPricePaid).' - Paid by hand'); ?></span><?php } ?><?php } ?></h1>
			
			<div class="whitebox-top"><div class="whitebox-bot"><div class="whitebox">
				<ul>
					<li><span>Client</span> <span><?php if ($user->level > 0) { echo anchor('viewuser/'.$job->owner_id, $owner->name); } else {  echo $owner->name; } ?></span></li>
					<li><span>Client ID</span> <span><?php echo $owner->user_id; ?></span></li>
					<li><span>Company</span> <span><?php if($owner->company !="") echo $owner->company;?></span></li>
					<li><span>e-mail</span> <span><?php echo $owner->username; ?></span></li>
					<li><span>Telephone</span> <span><?php echo $owner->phone; ?></span></li>
					<li><span>Job Status</span> <span><?php echo constant("JOB_STATUS_". $job->status); ?></span></li>
					<li><span>Start Date</span> <span><?php if ($job->start_date == "0000-00-00 00:00:00") { ?>&ndash;<?php } else { echo $job->start_date; } ?></span></li>
					<li><span>Total Price</span> <span><?php if ($job->price == 0) { ?>&ndash;<?php } else { echo $this->Jobs->formatPrice($job->price + ($job->price*$job->tax/100) - ($job->price*$job->discount/100)); } ?></span></li>
					<li><span>Payment Due Date</span> <span><?php if ($job->daysOver <= 14 && (($job->status == 2 && $job->cancel != 1) || ($job->status == 4 && $job->cancel != 1) || ($job->cancel == 1 && $job->cancelfee > 0 && $job->cancelfeepaid != 1))) { ?><span class="quantity link"><?php echo $this->Jobs->formatPrice($userPricePaid); ?></span><?php } else { ?>&ndash;<?php } ?></span></li>
					<li><span>Payment Overdue</span> <span><?php if ($job->daysOver > 14 && (($job->status == 2 && $job->cancel != 1) || ($job->status == 4 && $job->cancel != 1) || ($job->cancel == 1 && $job->cancelfee > 0 && $job->cancelfeepaid != 1))) { ?><span class="quantity link"><?php echo $this->Jobs->formatPrice($userPricePaid); ?></span><?php } else { ?>&ndash;<?php } ?></span></li>
					<span class="clr"></span>
				</ul>
				<?php if ($user->level > 0): ?>
				<?php if ($job->cal == 0): ?>
				<span class="google-calendar"><a href="<?php echo site_url(); ?>joborder/addcal/<?php echo $job->gid; ?>"><img src="<?php echo site_url(); ?>/assets/images/google-cal.jpg" /></a></span>
				<?php else: ?>
				<span class="google-calendar"><img src="<?php echo site_url(); ?>/assets/images/google-cal-done.jpg" /></span>
				<?php endif; ?>
				<?php endif; ?>
				<div class="clr"></div>
			</div></div></div>
			
			<div class="history">
				<a class="green" href="#request"><span>Request</span></a>
				<?php foreach ($chat as $msg): ?>
				<?php if (($job->status !=13 && $job->status !=14) || $msg->type != 7): ?>
				&raquo; <a class="<?php echo (($job->owner_id == $msg->uid) ? "green" : "black");?>" href="#message_<?php echo $msg->id; ?>"><span><?php echo constant("CHAT_TYPE_".$msg->type); ?></span></a>
				<?php endif;?>
				<?php endforeach; ?>
			</div>
			
		</div>
	</div> <!-- end of wrapper-world and .content -->
		
	<div class="wrapper">
	
		<div class="conv-left" id="request">
			<div class="avatar"><?php echo $job->date; ?></div>
			<div class="mid"><div class="top"><div class="bot">
				<p>I'd like to request a quote on the following job order:<p>
				
				<?php $c = 0; foreach ($jobs as $route): ?>
				<div class="job-<?php echo (($c%2 == 0) ? "odd" : "even"); ?>" id="job_<?php echo $route->id; ?>">
					<?php if ($route->job_type == 1): ?>
					<div class="job-type time-based">Time Based</div>
					<?php elseif ($route->job_type == 0): ?>
					<div class="job-type trip-based">Trip Based</div>
					<?php endif; ?>
					<div class="job-details"><?php echo nl2br($this->Jobs->formatJobInfo($route)); ?></div>
					<?php if ($user->level > 0 && $job->status == 0): // admin quote?>
					<div class="quote-price">Price, S$ : <input class="each-price" id="p<?php echo $route->id?>" name="p<?php echo $route->id?>" type="text"/></div>
					<div class="quote-price">Bus type : <input class="each-bus-type" id="t<?php echo $route->id?>" name="t<?php echo $route->id?>" type="text"/></div>
					<?php endif; ?>
					<div class="clr"></div>					
				</div>
				<?php $c++; endforeach; ?>
				
				<p>As additional remarks, I would like to add:<p>
				
				<p><?php echo htmlspecialchars($job->moreinfo); ?><p>
			</div></div></div>
			<div class="clr"></div>
		</div>
		
		<?php foreach ($chat as $msg): ?>
		<div class="conv-<?php echo (($job->owner_id == $msg->uid) ? "left": "right passive-right"); ?>" id="message_<?php echo $msg->id; ?>">
			<div class="avatar"><?php echo $msg->date; ?></div>
			<div class="mid"><div class="top"><div class="bot">
				<?php if ($msg->type > 0): ?>
				<?php
					if ($msg->type == 1) {
						// quote post
						$price = $job->price;
						$tax = $job->tax;
						$discount = $job->discount;
						
						$msg->text = str_replace(
							array('##PRICE##', '##TAX##', '##DISCOUNT##', '##TOTAL##'),
							array(
								$this->Jobs->formatPrice($price, false),
								$this->Jobs->formatPrice($price * $tax/100, false),
								$this->Jobs->formatPrice($price * $discount/100, false),
								$this->Jobs->formatPrice(($price) + ($price * $tax/100) - ($price * $discount/100), false)
							),
							$msg->text);
					}
				?>
				<?php echo $msg->text; ?>
				<?php else: ?>
				<p><?php echo nl2br(htmlspecialchars($msg->text)); ?></p>
				<?php endif; ?>
			</div></div></div>
			<div class="clr"></div>
		</div>
		<?php endforeach; ?>
		
		<?php if ($job->status < 7 || $job->status==13 || $job->status==14): ?>
		<div class="conv-<?php echo (($job->owner_id == $user->id) ? "left": "right"); ?>" id="actionForm">
			<div class="avatar"><?php echo date("j M Y, H:i"); ?></div>
			<div class="mid"><div class="top"><div class="bot">
				<div class="two-halves">
					<div class="half">
						<h3>Send additional message</h3>
						<?php echo form_open('joborder/post/'.$job->gid); ?>
							<div class="one">
								<label for="message">Message:</label>
								<div class="type-textarea"><textarea name="message" id="message"></textarea></div>
								<div class="clr"></div>
							</div>
							<div class="one">
								<div class="type-btn"><?php echo form_submit('sendmessage', 'Submit'); ?></div>
								<div class="clr"></div>
							</div>
						</form>
					</div>
					<div class="half">
					<?php if ($user->level != 2): // if not operation admin ?>
					<?php if ($job->owner_id == $user->id): // user actions ?>
					<?php if ($job->cancel == 1): // marked for cancellation ?>
						<?php if ($job->cancelfee > 0 && $job->cancelfeepaid != 1): ?>
						<?php// if ($job->cancelfee > 0 && $job->cancelfeepaid != 1 && $job->satus >2): ?>
						<h3>Make a payment</h3>
						<p>Payment needed is <?php echo $this->Jobs->formatPrice($job->cancelfee); ?>.
						<?php echo form_open('joborder/post/'.$job->gid); ?>
							<div class="one no-left">
								<?php $pmethods = json_decode($job->pmethods); ?>
								<?php if (in_array("paypal", $pmethods)): ?>
								<label class="radio"><input class="p_paypal" type="radio" name="payment" value="paypal" />PayPal</label>
								<?php endif; ?>
								<?php if (in_array("bank", $pmethods)): ?>
								<label class="radio"><input class="p_bank" type="radio" name="payment" value="bank" />Bank Transfer</label>
								<?php endif; ?>
								<?php if (in_array("cheque", $pmethods)): ?>
								<label class="radio"><input class="p_cheque" type="radio" name="payment" value="cheque" />Cheque</label>
								<?php endif; ?>
								<div class="clr"></div>
							</div>
							<div class="one">
								<label>Amount, S$</label>
								<div class="type-text"><?php echo $this->Jobs->formatPrice($job->cancelfee, false); ?></div>
								<div class="clr"></div>
							</div>
							<div class="one" id="snumber" style="display: none;">
								<label>Reference Number</label>
								<div class="type-text"><input name="snumber" type="text" /></div>
								<div class="clr"></div>
							</div>
							<div class="one">
								<div class="type-btn"><?php echo form_submit("sendpayment", "Submit"); ?></div>
								<div class="clr"></div>
							</div>
						</form>
						<?php endif; ?>
					<?php else: ?>
					<?php if ($job->status == 1): // accept/reject quote ?>
						<h3>Accept or Deny</h3>
						<div class="centered">
						<p>The amount quoted for the job is S$ <?php echo $this->Jobs->formatPrice(($job->price) + ($job->price * $job->tax/100) - ($job->price * $job->discount/100), false)?></p>
						<p>Please note that upon acceptance you'll need to pay <?php echo $this->Jobs->formatPrice($job->preq); ?> in advance.</p>
							<script type="text/javascript">
								function acceptAndSubmit() {
									jQuery("form[name=acceptDenyForm]").attr("action", "<?php echo site_url(); ?>joborder/accept/<?php echo $job->gid; ?>");
									
									jQuery("form[name=acceptDenyForm]").submit();
								}
								
								function denyAndSubmit() {
									jQuery("form[name=acceptDenyForm]").attr("action", "<?php echo site_url(); ?>joborder/deny/<?php echo $job->gid; ?>");
									
									jQuery("form[name=acceptDenyForm]").submit();
								}
							</script>
							<form action="" method="post" name="acceptDenyForm">
								<div class="one">
									<label for="acceptDenyMsg">Additional info:</label>
									<div class="type-textarea"><textarea name="acceptDenyMsg" id="acceptDenyMsg"></textarea></div>
									<div class="clr"></div>
								</div>
								<div class="one no-left diff-btn">
									<?php echo anchor('#', 'ACCEPT', 'class="accept" onclick="acceptAndSubmit(); return false;"'); ?>
									<?php echo anchor('#', 'DENY', 'class="deny" onclick="denyAndSubmit(); return false;"'); ?>
								</div>
							</form>
						</div>
					<?php elseif (/*($job->status == 2) ||*/ ($job->status >= 4)): // payment form ?>
					<?php //elseif (($job->status == 21) || ($job->status >= 4)): // payment form ?>
						<h3>Make a payment</h3>
						<p>Payment needed is <?php echo $this->Jobs->formatPrice($this->Jobs->neededPayment($job->gid)); ?>.
						<?php echo form_open('joborder/post/'.$job->gid); ?>
							<div class="one no-left">
								<?php $pmethods = json_decode($job->pmethods); ?>
								<?php if (in_array("paypal", $pmethods)): ?>
								<label class="radio"><input class="p_paypal" type="radio" name="payment" value="paypal" />PayPal</label>
								<?php endif; ?>
								<?php if (in_array("bank", $pmethods)): ?>
								<label class="radio"><input class="p_bank" type="radio" name="payment" value="bank" />Bank Transfer</label>
								<?php endif; ?>
								<?php if (in_array("cheque", $pmethods)): ?>
								<label class="radio"><input class="p_cheque" type="radio" name="payment" value="cheque" />Cheque</label>
								<?php endif; ?>
								<div class="clr"></div>
							</div>
							<div class="one">
								<label>Amount, S$</label>
								<div class="type-text"><?php echo $this->Jobs->formatPrice($this->Jobs->neededPayment($job->gid), false); ?><!-- <input name="price" type="text" value="<?php echo $this->Jobs->neededPayment($job->gid); ?>"/> --></div>
								<div class="clr"></div>
							</div>
							<div class="one" id="snumber" style="display: none;">
								<label>Reference Number</label>
								<div class="type-text"><input name="snumber" type="text" /></div>
								<div class="clr"></div>
							</div>
							<div class="one">
								<div class="type-btn"><?php echo form_submit("sendpayment", "Submit"); ?></div>
								<div class="clr"></div>
							</div>
						</form>
					<?php endif; // job action ?>
					<?php endif; // cancellation ?>
					<?php else: // admin actions ?>
					<?php if ($job->cancel == 1): // cancellation ?>
						<?php if ($job->cancelfee > 0): ?>
							<?php if ($job->cancelfeepaid == 1): // user paid ?>
							<h3>Notify about received payment</h3>
							<div class="centered">
							<?php 
							$sentPrice = $this->Chats->getSentPrice($job->gid);
							?>
							<p>The expected amount is <?php echo $this->Jobs->formatPrice($job->cancelfee); ?> via <?php echo constant("CHAT_PAYMENT_".$sentPrice->payment); ?></p>	
								<?php echo anchor('joborder/receive/'.$job->gid, 'PAYMENT RECEIVED', 'class="accept"'); ?>
							</div>
							<?php endif; ?>
						<?php else: ?>
						<?php echo form_open('joborder/post/'.$job->gid); ?>
							<div class="one">
								<label>Cancellation fee</label>
								<div class="type-text"><input type="text" name="fee" /></div>
								<div class="clr"></div>
							</div>
							<div class="one">
								<div class="type-btn"><?php echo form_submit('setcancelfee', 'Submit'); ?></div>
								<div class="clr"></div>
							</div>
						</form>
						<?php endif; ?>
					<?php else: ?>
					<?php if ($job->status == 0): // quote?>
						<h3>Quote</h3>
						<?php echo form_open('joborder/post/'.$job->gid); ?>
							
							<?php foreach ($jobs as $route): ?>
								<?php if ($user->level > 0 && $job->status == 0): // admin quote?>
									<input type="hidden" id="pp<?php echo $route->id?>" name="pp<?php echo $route->id?>" type="text"/>
									<input type="hidden" id="tt<?php echo $route->id?>" name="tt<?php echo $route->id?>" type="text"/>
								<?php endif; ?>									
							<?php endforeach; ?>
							
							<div class="one">
								<label for="price">Price, S$</label>
								<div class="type-text disabled"><input type="text" name="mprice" id="mprice" disabled="disabled"/></div>
								<input type="hidden" name="price" id="price"/>
								<div class="clr"></div>
							</div>
							<div class="one">
								<label for="tax">Tax, %</label>
								<div class="type-text"><input type="text" name="tax" id="tax" /></div>
								<div class="clr"></div>
							</div>
							<div class="one">
								<label for="discount">Discount, %</label>
								<div class="type-text"><input type="text" name="discount" id="discount" /></div>
								<div class="clr"></div>
							</div>
							<div class="one">
								<label>Total, S$</label>
								<div class="no-input" id="calcTotalPrice">0.00</div>
								<div class="clr"></div>
							</div>
							<div class="one" style="display: block;">
								<label>Required deposit, s$</label>
								<div class="type-text"><input type="text" name="preq" id="preq" value="0" /></div>
								<div class="clr"></div>
							</div>
							<div class="one no-left">
								Terms and Conditions:
								<?php foreach ($docs as $doc): ?>
								<label class="radio"><input type="radio" name="terms" value="<?php echo htmlspecialchars($doc->id); ?>" /><?php echo htmlspecialchars($doc->name); ?></label>
								<?php endforeach; ?>
								<div class="clr"></div>
							</div>
                                                
                                                        <div class="one no-left">
								Payment terms:
								<label class="radio"><input type="radio" name="paymentterms" value="1" />Pre-pay</label>
								<label class="radio"><input type="radio" name="paymentterms" value="0" />COD</label>	
                                <label class="radio"><input type="radio" name="paymentterms" value="7" />7 Days</label>
                                <label class="radio"><input type="radio" name="paymentterms" value="15" />15 Days</label>
                                <label class="radio"><input type="radio" name="paymentterms" value="30" />30 Days</label>
								<div class="clr"></div>
							</div>
                                                
							<div class="one no-left">
								Accepted payment Methods:
								<label class="radio"><input type="checkbox" name="paypal" value="1" />PayPal</label>
								<label class="radio"><input type="checkbox" name="bank" value="1" />Bank Transfer</label>
								<label class="radio"><input type="checkbox" name="cheque" value="1" />Cheque</label>
								<div class="clr"></div>
							</div>	
							<div class="one">
								<label>Job Duration (days)</label>
								<div class="type-text"><input type="text" name="duration" /></div>
								<div class="clr"></div>
							</div>
							<div class="one">
								<label>Invalid after</label>
								<div class="type-text"><input type="text" name="invalidafter" id="invalidafter" /></div>
								<div class="clr"></div>
							</div>
							<script type="text/javascript">
								AnyTime.picker( "invalidafter",
									{ format: "%z-%m-%d %H:%i", firstDOW: 1, earliest: new Date() } );
							</script>
							<div class="one">
								<label for="moreinfo">Message:</label>
								<div class="type-textarea"><textarea name="moreinfo" id="moreinfo"></textarea></div>
								<div class="clr"></div>
							</div>
							<div class="one">
								<div class="type-btn"><?php echo form_submit('sendquote', 'Submit'); ?></div>
								<div class="clr"></div>
							</div>
						</form>
					<?php elseif (($job->status == 3) || ($job->status == 6)): // receive payment ?>
						<h3>Notify about received payment</h3>
						<div class="centered">
						<?php 
						$sentPrice = $this->Chats->getSentPrice($job->gid);
						?>
						<p>The expected amount is <?php echo $this->Jobs->formatPrice($sentPrice->paid); ?> via <?php echo constant("CHAT_PAYMENT_".$sentPrice->payment); ?></p>	
							<?php echo anchor('joborder/receive/'.$job->gid, 'PAYMENT RECEIVED', 'class="accept"'); ?>
						</div>
					<?php endif; ?>
					<?php if (($job->status >= 1) && ($job->status < 7)): // change price ?>
						<h3>Job price changes:</h3>
						<?php echo form_open('joborder/post/'.$job->gid); ?>
							<div class="one">
								<label>Reason</label>
								<div class="type-text"><input type="text" name="reason" /></div>
								<div class="clr"></div>
							</div>
							<div class="one">
								<label>Amount, S$</label>
								<div class="type-text"><input type="text" name="amount" /></div>
								<div class="clr"></div>
							</div>
							<div class="one">
								<div class="type-btn"><?php echo form_submit('changeprice', 'Submit'); ?></div>
								<div class="clr"></div>
							</div>
						</form>
					<?php endif; // price changes ?>
					<?php endif; // job actions ?>
					<?php endif; // cancellation ?>
					<?php endif; // if not operation admin ?>
					</div>
					<div class="clr"></div>
				</div>
			</div></div></div>
			<div class="clr"></div>
		</div>
		<?php endif; ?>
		
	</div>
	
	<div class="wrapper-world footer-top">
		<div class="wrapper"></div>	
	</div>        
	<?php $this->load->view('footer'); ?>
</body>
</html>
